﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AspDotNet.Framework.CommonLibs
{
    public static class ReflectTool
    {
        public static bool HasParent<Parent>(this Type child)
        {
            if (child == null || child.BaseType == null)
            {
                return false;
            }
            var parentType = typeof(Parent);
            if (child.FullName == parentType.FullName
                || child.BaseType.FullName == parentType.FullName)
            {
                return true;
            }
            return HasParent<Parent>(child.BaseType);
        }
    }
}
